<?php

namespace app\admin\controller\live;

use app\common\controller\AdminController;
use app\common\service\lib\UploadFile;
use app\common\service\live\LiveHostService;
use app\Request;
use EasyAdmin\annotation\ControllerAnnotation;
use EasyAdmin\annotation\NodeAnotation;
use think\App;

/**
 * @ControllerAnnotation(title="live_host")
 */
class LiveHost extends AdminController
{

    use \app\admin\traits\Curd;

    public function __construct(App $app)
    {
        parent::__construct($app);

        $this->model = new \app\admin\model\live\LiveHost();
        
    }


    /**
     * Author:YangXinPeng
     * 身份证图片扫描
     * @param Request $request
     * @return \think\response\Json
     */
    public function ocr(Request $request)
    {
        $params = $request->get();
        $params['side'] = "face";
        $res =  LiveHostService::main($params);
        return json($res);
    }

    /**
     * Author:YangXinPeng
     * Oss身份证上传
     * @return \think\response\Json
     */
    public function upload()
    {
        $file = $this->request->file('file')->getPathName();
        $path = UploadFile::cardUpload($file);
        return json(['url' => $path]);
    }

    
}